import request from '@/request/index.js';
import urlConfig from "@/request/urlConfig.js"; // 引入接口地址配置
/*
 * 上传图片
 */
export const uploadImgUrl = urlConfig.baseURL + '/phone/file/noBuildFileUpload'
export const FILE_URL = urlConfig.nearbyUrl
/**
 * 查询列表
 */
export const uploadBase64Img = (data) => {
	return request.post({
		url: '/phone/file/base64ImgUpload',
		data: data,
	});
};
/**
 * 申报非竞价查询班组
 */
export const getTeamList = (data) => {
	return request.get({
		url: 'phoneOverhaul/getTeamList',
		data: data,
	});
};
/**
 * 查询三级部门
 */
export const getThirdLevelDepts = (data) => {
	return request.get({
		url: '/phoneOverhaul/getThreeDeptList',
		data: data,
	});
};
/**
 * 检修装置列表
 */
export const getEqList = (data) => {
	return request.get({
		url: '/phoneOverhaul/getOverhaulEquipmentList',
		data: data,
	});
};
/**
 * 检修申报
 */
export const saveOverhaulInfo = (data) => {
    console.log('data', data);
    const formData = new FormData();
    for (const key in data) {
        if (data.hasOwnProperty(key)) {
            formData.append(key, data[key]);
        }
    }
	let formDataStr = '';
	formData.forEach((value, key) => {
	  if (formDataStr !== '') {
	    formDataStr += '&';
	  }
	  formDataStr += encodeURIComponent(key) + '=' + encodeURIComponent(value);
	});
	return request.post({
		url: `/phoneOverhaul/saveOverhaulInfo`,
		data: formDataStr,
		headerIndex:4
	});
};
/**
 * 施工类型列表
 */
export const getBuildType = (data) => {
	return request.get({
		url: '/phoneOverhaul/getBuildTypeList',
		data: data,
	});
};
/**
 *  检修验收，最终验收，终止审核列表
 */
export const queryOverhaulVerifyList = (data) => {
	return request.get({
		url: '/phoneOverhaul/queryOverhaulVerifyList',
		data: data,
	});
};
/**
 *    检修验收,最终验收 保存
 */
export const saveOverhaulVerify = (data) => {
	return request.post({
		url: '/phoneOverhaul/saveOverhaulVerify',
		data: data,
	});
};

/**
 *   待竞价列表
 */
export const queryBeforeBiddingList = (data) => {
	return request.get({
		url: '/phoneOverhaul/queryBeforeBiddingList',
		data: data,
	});
};
/**
 *   待竞价列表
 */
export const queryBiddingList = (data) => {
	return request.get({
		url: '/phoneOverhaul/queryBiddingList',
		data: data,
	});
};
/**
 *  提交竞价  
 * */
export const saveBiddingInfo = (data) => {
	return request.get({
		url: '/phoneOverhaul/saveBiddingInfo',
		data: data,
	});
};

/**
 * 竞价任务指派列表
 */
export const queryAssignList = (data) => {
	return request.get({
		url: '/phoneOverhaul/queryAssignList',
		data: data,
	});
};
/**
 * 报价结果列表
 */
export const queryBiddingTeamList = (data) => {
	return request.get({
		url: '/phoneOverhaul/queryBiddingTeamList',
		data: data,
	});
};


/**
 * 任务指派列表, 接单列表, 检修确认列表
 * 参数 type 1/2/3
 */
export const queryOverhaulList = (data) => {
	return request.get({
		url: '/phoneOverhaul/queryOverhaulList',
		data: data,
	});
};

/**
 * 任务指派保存
 */
export const saveTaskAssigned = (data) => {
	return request.post({
		url: '/phoneOverhaul/saveTaskAssigned',
		data: data,
	});
};
/**
 * 指派主修人 配合人下拉列表
 */
export const queryTeamMembersList = (data) => {
	return request.get({
		url: '/phoneOverhaul/getTeamMembersList',
		data: data,
	});
};


/**
 * 接单提交
 */
export const saveTakeOrders = (data) => {
	return request.post({
		url: '/phoneOverhaul/saveTakeOrders',
		data: data,
	});
};

/**
 * 检修确认保存
 */

export const saveOverhaulConfirm = (data) => {
	return request.post({
		url: '/phoneOverhaul/saveOverhaulConfirm',
		data: data,
	});
};
/**
 * 查询安全措施列表
 */
export const queryCheckCfgList = (data) => {
	return request.get({
		url: '/phoneOverhaul/listOverhaulCheckCfg',
		data: data,
	});
};


/*
 * 根据部门查询人员
 */
export const getUserByDept = (data) => {
	return request.get({
		url: '/phoneCommon/findUserByDept',
		data: data,
	});
};
/**
 * 检修处理列表
 */
export const queryOverhaulHandleList = (data) => {
	return request.get({
		url: '/phoneOverhaul/queryOverhaulHandleList',
		data: data,
	});
};
/**
 * 检修处理保存
 */
export const saveOverhaulHandleResult = (data) => {
	return request.post({
		url: '/phoneOverhaul/saveOverhaulHandleResult',
		data: data,
	});
};

/**
 * 公用详情
 */
export const getOverhaulInfo = (data) => {
	return request.get({
		url: '/phoneOverhaul/getOverhaulInfo',
		data: data,
	});
};

/**
 * 终止审核 保存
 */
export const doSuspendAudit = (data) => {
	return request.get({
		url: '/phoneOverhaul/doSuspendAudit',
		data: data,
	});
};
/**
 * 检修台账列表
 */
export const queryOverhaulManageList = (data) => {
	return request.get({
		url: '/phoneOverhaul/queryOverhaulManageList',
		data: data,
	});
};
/**
 * 查询部门树 typ=1 查询当前登录用户部门及以下
 */
export const queryDeptTree = (data) => {
	return request.get({
		url: '/phoneOrg/queryDeptTree',
		data: data,
	});
}
/**
 * 申报审核列表
 * 参数 type 0/1
 */
export const queryAuditList = (data) => {
	return request.get({
		url: '/phoneOverhaul/queryAuditList',
		data: data,
	});
}

/**
 * 外协-查询负责人
 */
export const getChargeUser = (data) => {
	return request.get({
		url: '/phoneOverhaul/getChargeUserList',
		data: data,
	});
}
// 审核确认
export const saveAuditInfo = (data) => {
	return request.post({
		url: '/phoneOverhaul/saveAuditInfo',
		data: data,
	});
}

/**
 * 确定班组 保存
 */
export const saveConfirmTeam = (data) => {
	return request.get({
		url: '/phoneOverhaul/saveConfirmTeam',
		data: data,
	});
}
/**
 * 问题登记 扫码 或 模糊查询 设备列表 分页
 */
export const getDeviceList = (data) => {
	return request.get({
		url: '/phoneOverhaul/getDeviceList',
		data: data,
	});
}
/**
 * 获取缺陷申报 获取位置信息
 */
export const getBasePartitionList = (data) => {
	return request.post({
		url: '/phoneFault/getBasePartitionList',
		data: data,
	});
}
// 获取待变列表 
export const getWaitieProcessList = (params) => {
	return request.get({
		url: '/phoneOverhaul/getWaitieProcessList',
		data: params,
	});
};
// 获取待办详情   
export const getWaitieProcessDetails = (params) => {
	return request.get({
		url: '/phoneOverhaul/getWaitieProcessDetails',
		data: params,
	});
};